Basic Types and Constants
The data types defined in this section are used by other structures and functions of the Open Transport API. They are not specific to TCP/IP, but are included here for your convenience.
typedef unsigned char UInt8; typedef unsigned short UInt16; typedef unsigned long UInt32; typedef char SInt8; typedef short SInt16; typedef long SInt32; typedef UInt16 InetPort; typedef UInt32 InetHost;You can use the protocol nameskTCPName
,kUDPName
, andkRawIPName
when calling theOTCreateConfiguration
function to configure an endpoint. You can use the protocol namekDNRName
when calling theOTCreateConfiguration
function to configure a mapper. TheOTCreateConfiguration
function is described in the chapter "Configuration Management" in this book.
#define kDNRName 'dnr' #define kTCPName 'tcp' #define kUDPName 'udp' #define kRawIPName 'rawip'You can use the constantkDefaultInternetServicesPath
to create a TCP/IP service provider. Its value is a pointer to a configuration structure, so you do not use theOTCreateConfiguration
function with this constant. Instead you use this constant as a parameter when calling theOTAsyncOpenInternetServices
and theOTOpenInternetServices
functions that create TCP/IP service providers.
#define kDefaultInternetServicesPath((OTConfiguration*)-3)You use theAF_INET
andAF_DNS
values as address types when filling in address structures (see "Internet Address Structure" on page 8-22 and "DNS Address Structure" on page 8-23). You can use thekOTAnyInetAddress
value with theOTBind
function (page 8-15).
enum { AF_INET = 2,, /* TCP/IP address */ AF_DNS = 42 /* domain name server address */ };You can use thekOTAnyInetAddress
value with theOTBind
function (page 8-15).
enum { kOTAnyInetAddress = 0 /* wildcard */ }; enum { kMaxHostAddrs = 10, kMaxSysStringLen = 32, kMaxHostNameLen = 255 }; typedef char InetDomainName[kMaxHostNameLen];The following completion event codes are returned by TCP/IP service
- Note
- The maximum valid domain-name length for fully qualified domain names includes the trailing period (.). Names not terminated with a period are limited to
254 bytes.![]()
provider functions:
enum { T_DNRSTRINGTOADDRCOMPLETE = kPRIVATEEVENT+1, T_DNRADDRTONAMECOMPLETE = kPRIVATEEVENT+2, T_DNRSYSINFOCOMPLETE = kPRIVATEEVENT+3, T_DNRMAILEXCHANGECOMPLETE = kPRIVATEEVENT+4, T_DNRQUERYCOMPLETE = kPRIVATEEVENT+5 }; enum { kDefaultInetInterface = -1, kInetInterfaceInfoVersion = 2 }; enum { kPRIVATEEVENT= (OTEventCode)0x10000000 };The following are miscellaneous TCP/IP-related constants. Some, such as the version number, are subject to change.
#define kInetVersion "3.0" /* MacTCP 3.0*/ #define kInetPrefix "ot:inet$" #define SET_TOS(prec,tos)(((0x7 & (prec)) << 5) | (0x1c & (tos)))